
#import "SceneDelegate.h"
#import "SMAuthManager.h"
#import "SMRootTabBarController.h"
#import "SMLoginViewController.h"

@implementation SceneDelegate
- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions {
    if (![scene isKindOfClass:[UIWindowScene class]]) return;
    self.window = [[UIWindow alloc] initWithWindowScene:(UIWindowScene *)scene];
    UIViewController *rootVC;
    if ([[SMAuthManager shared] isLoggedIn]) {
        rootVC = [SMRootTabBarController new];
    } else {
        rootVC = [[UINavigationController alloc] initWithRootViewController:[SMLoginViewController new]];
    }
    self.window.rootViewController = rootVC;
    [self.window makeKeyAndVisible];
}
@end
